package com.wxy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wxy.entity.Saleyeardata;
import com.wxy.entity.Staff;
import com.wxy.entity.StaffDetailWages;
import com.wxy.entity.Staffinfor;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.sql.Date;
import java.util.List;

@Mapper
public interface StaffDetailWagesMapper extends BaseMapper<Staffinfor>{
    @Select("select time,name,commission,note from staff,staffInfor where staff.userId = staffInfor.userId and staff.staffId = staffInfor.staffId and staff.userId = #{ userId } order by staffinfor.time desc limit #{ page },10")
    List<StaffDetailWages> selectAllDetail(@Param("userId") Integer userId, @Param("page") Integer page);

    @Select("select count(*) from staff,staffInfor where staff.userId = staffInfor.userId and staff.staffId = staffInfor.staffId and staff.userId = #{ userId }")
    Integer selectDetailWagesTotil(@Param("userId") Integer userId);

    @Select("select time,name,commission,note from staff,staffInfor where staff.userId = staffInfor.userId and staff.staffId = staffInfor.staffId and staff.userId  = #{ userId }  and staffInfor.time =#{date}")
    List<StaffDetailWages> selectAllDetailByTime(@Param("userId") Integer userId,@Param("date") Date date);

    @Select("select time,name,commission,note from staff,staffInfor where staff.userId = staffInfor.userId and staff.staffId = staffInfor.staffId and staff.userId  = #{ userId }  and  staff.staffId = #{ staffId }")
    List<StaffDetailWages> selectAllDetailByStaffId(@Param("userId") Integer userId,@Param("staffId") Integer staffId);
}
